import os
basedir = os.path.abspath(os.path.dirname(__file__))

class Config:
    # key的所有英文字母都要大写
    SECRET_KEY = 'abcdefgwjkdfsawerew'
    
    SQLALCHEMY_TRACK_MODIFICATION = False

    # 邮箱配置
    MAIL_SERVER = 'smtp.qq.com'
    MAIL_POST = 587
    MAIL_USE_TSL = True
    MAIL_USERNAME = '你的邮件'
    MAIL_PASSWORD = '你的授权码'
    FLASKY博客邮件主题前缀 = '[Flasky博客]'
    FLASKY邮件发送者 = 'Flasky管理员<你的邮件>'
    FLASKY管理员 = '你的邮件'
    FLASKY_POSTS_PER_PAGE = 10

    @staticmethod
    def init_app(app):
        pass

class DevelopmentConfig(Config):
    DEBUG = True
    # SQLALCHEMY_DATABASE_URI = 'postgresql://postgres:123456@localhost/bigblog'
    # SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://root:123456@localhost/bigblog'
    SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'data.sqlite')

class TestingConfig(Config):
    TESTING = True
    # SQLALCHEMY_DATABASE_URI = 'postgresql://postgres:123456@localhost/bigblog'
    # SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://root:123456@localhost/bigblog'
    SQLALCHEMY_DATABASE_URI = 'sqlite://'

class ProductionConfig(Config):
    SQLALCHEMY_DATABASE_URI = 'postgresql://postgres:123456@localhost/bigblog'
    # SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://root:123456@localhost/bigblog'
    # SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'data.sqlite')

config = {
    "development" : DevelopmentConfig,
    "testing" : TestingConfig,
    "production" : ProductionConfig,
    "default" : DevelopmentConfig
}